<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .box {
            margin: 100px 200px;
        }

        input {
            outline: none;
        }
    </style>
</head>

<body>
    <div class="box">
        <div class="con">京东物流</div>
        <input type="text" placeholder="请输入查询单号" class="jd">
    </div>
    <script>
        var con = document.querySelector('.con');
        var jd_input = document.querySelector('.jd');
        jd_input.addEventListener('keyup', function () {
            if (this.value == '') {
                con.innerText = '京东物流'
            } else {
                con.innerText = this.value;
               
            }
        })

        //焦点 
        jd_input.addEventListener('focus', function () {
            if (this.value !== '') {
                con.style.display = 'block';
            }
        })
        jd_input.addEventListener('blur', function () {
            con.style.display = 'none';

        })

    </script>
</body>

</html>